local function main (userOb, msgData)
    if not msgData.id then
        return
    end

    local player = userOb:get_partner(msgData.id)
    if not player then
        local result = {}
        result.code = 400
        userOb:send_packet("MSGS2CPartherInRank", result)
        return
    end

    if player.advanced_level >= 2 then
        local result = {}
        result.code = 401
        userOb:send_packet("MSGS2CPartherInRank", result)
        return
    end

    local use_yuanbao = tonumber(player.advancedYuanbao)
    if not use_yuanbao then
        local result = {}
        result.code = 402
        userOb:send_packet("MSGS2CPartherInRank", result)
        return
    end

    local yuanbao = userOb:get_currency(GamePropIds.kGamePropIdsDiamondsIcon)
    if yuanbao < use_yuanbao then
        local result = {}
        result.code = 403
        userOb:send_packet("MSGS2CPartherInRank", result)
        return
    end

    ---! 扣除货币
    userOb:cost_currency(GamePropIds.kGamePropIdsDiamondsIcon, use_yuanbao)

    ---! 进阶伙伴
    player.advanced_level = 2

    local result = {}
    result.code = 200
    result.msgData = player
    result.id = msgData.id
    userOb:send_packet("MSGS2CPartherInRank", result)
    ITEM_D:send_currency_info(userOb)
end

--注册方法
COMMAND_D:register_command("MSGC2SPartherInRank",GameCmdType.NONE, main)
